
#include <iostream>
#include <cmath>
using namespace std;

struct Complex
{
double re;
double im;
};



Complex vvod(Complex a)
{
    Complex c;
    cout<<"vvedite deistvitelnu chast 1 - ";
    cin>>(c.re);
    cout<<"\n"<<"vvedite mnimu chast 1 - ";
    cin>>(c.im);
    cout<<"\n";
    a.re=c.re; a.im=c.im;
    return c;
}

Complex plusa(Complex a,Complex b)
{
    Complex c;
    c.re=a.re+b.re;
    c.im=a.im+b.im;
    return c;
}

Complex minusad (Complex a,Complex b)
{
    Complex v;
    v.re=a.re-b.re;
    v.im=a.im-b.im;
    return v;
}

Complex proisved (Complex a,Complex b)
{
    Complex x;
    x.re=(a.re)*(b.re)-(a.im)*(b.im);
    x.im=(a.re)*(b.im)+(b.re)*(a.im);
    return x;
}

double modif (Complex a)
{
    double p=sqrt(a.re*a.re+a.im*a.im);
    return p;
}

Complex delenie (Complex a,Complex b)
{
    Complex d;
    double p1=sqrt(a.re*a.re+a.im*a.im);
    double p2=sqrt(b.re*b.re+b.im*b.im);
    double a1=atan(a.im/a.re);
    double a2=atan(b.im/b.re);
    double h=(p1)/(p2);
    double g=(a1)-(a2);
     d.re=h*cos(g);
     d.im=h*sin(g);
    return d;
}

void vivod (Complex a)
{
    if(a.im<0)
    cout<<(a.re)<<" - "<<-(a.im)<<"i"<<endl;
    else
    cout<<(a.re)<<" + "<<(a.im)<<"i"<<endl;
}



int main()
{
Complex a,b,c,v,n,m;
double d;
a=vvod(a);
b=vvod(b);
c=plusa(a,b);
v=minusad(a,b);
d=modif(a);
n=proisved(a,b);
m=delenie(a,b);

cout<<"a = ";
vivod(a);
cout<<"b = ";
vivod(b);
cout<<"a+b = ";
vivod(c);
cout<<"a-b = ";
vivod(v);
cout<<"|a| = ";
cout<<(d)<<endl;
cout<<"a*b = ";
vivod(n);
cout<<"a/b = ";
vivod(m);


    return 0;
}
